let { observable, observe, computed, autorun, when, reaction, action, runInAction } = require("mobx");

class Person {
    @observable name = "js";
    @observable age = 9;
    @observable list = {
        id: "1",
        name: "2"
    }
    //手机号拼接
    @observable area = "010";
    @observable photo = "15945789456";

    @computed get home() {
        return this.area + "_" + this.photo
    }
    @action.bound chengphoto(area, number) {  // 
        this.area = area;
        this.photo = number;
    }

}
let p1 = new Person();

//监听数据变化，数据当变化时，监听
autorun(() => {
    console.log(p1.home)
})


runInAction(()=>{
    p1.name = "html";
    p1.photo = "100";
})






